package com.yehuishou.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id ="2018071360616120";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjjPaXVVDcvFvh3sa911Op5O8xrTM3gdXs2Jp7pPdMAH5PLQKK6q57lLNdqji3S4wbo/fBG6Hw7N/DX6IVes3AGwL01l07YfhZPHJFfZvRLDbQgilP9NdnUJZFHemW7AOYMyxLp5hH0wgdQMEP26Vyp/yoIK2LpJexk8LsZDO8tJxiDSnrruCDUHEj01OWgxyPxqLm7O0MaioOq2rV9cuGyIHamXPrcZtx+fPDGKOfoKkx+Hg1DOsrpVFyBnLq3qysUqkhKv6XHcPydo5Nf26aZctxJR+LDiLdyg3hyO/3nFdkO0aECCwOcB9oGDEkAYYr/1ZP94fcqkotMWtFDqy/AgMBAAECggEAHsZrsFZRfPfEol/1LcvS5mk5yTM6K/u2cXbguttz3U1Kd0OU8ubuJjr49WsOeQ8yMhFMkX3NnzQzduQL79bH2Jo8mC2uJXpt7Py+0+yq4VVciyey9mSwE7TKUf8q8Uc/9efLMgE7WmiPYlHJAl7mZwjNNiXQAjLaiIOxbiH8ykk0oNZBAt6MXGK/Ygk7hJGXM5TyklFp//0vS8ToX8yy0XDw1dwFWSGTApdNrnXdtDLm7Pa8+C5d9qJGMTMNVYtN33C2x0NVunOwbAY4or8ePA6jzGVYkK2qNykwBltBYAYiNYQSvDwCkgnwsPYhuJjIjg/O6onpINof589NRtxqIQKBgQDjx9dc856DsaT2oX8oCxPDG+Jj4+92AIEjpqDpUyb4Ifr73iWFgNPNidxbeILIlStKHk7eWALV602Bi2E7MfVwFmvxmw+GvcLeC83Qz0OcilAAjqGoBmg4+ODSs/pUqB9c1vPUoFw2rZyZvpSDs9/hpT8w0JA2PjXvYvIWEJMIXQKBgQC30Apq4VI54gvjXgd+4BvR6eH1n4NlP2jVEC9JsjL+8XiHwTr8LTEwt1NQQzReMeNUSO/kc8N1OF3bSa53EP/AY8beOBe2AYPbsYtU7kEdT4Goxuv9P0RJSRCbbVgz8hU4a8SocAdSqwzCoiYKTHT8psuAihkbFwnNwTaCKmaHywKBgHYx4a/q/msJyDbuMERAEz4f/wakZUKPGnO8aC0Kp+MEBu+hI0k2QzGZgs24J+0bcn4gYf6AHuCQHATHpWmJD/ncuKCDPLhHSZHdACyFEGlvX/oaCQpeYMCHbGoJWDGLl9Kd+6Jun8sDpYol2XzJ3reA/tw+rUZoW6Zfao1GhnVFAoGAabfY1gID5dCx37JMA1foCEJJOJjm3IuswqZNXEiGdgTxurqTL0jautclrssISojM48QTXUSLjVa+/ImTM13uinuYfGSslnymluu1ZEKn5rC8tRK71erWXoQMbihki3PXapzo/at5Or2wWB0kXdX9jvZrouFKcT893z4aGKFEWSMCgYEAisAy989kbUhp++E6xs41lFnMTTFdISDNdIulshipHAIW304P5lVm11nxTjgAZN1QMFaoWE8DepRUwvH3tpHVINbxdVEdyciQg8bmDNTtO+0xnf4fPxnABozu6m5h8drnxGvLv7Wepkm4OG+T7qoGklmexa9DPELnGHQBRf4/P9I=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAukus2F3yx/NK8PS+Xzce2OJ7SbURgmo6BEHOb51mq958yTGtj6ffQTQUQVFvOCSKe3QtZ1zBI6v9YWO9uFnltlAaNtEJ2gu7FK5qu5+QNZLn5QJKREhXmJosvNLrLB0JrjjWxRo4IA02EIanMgyeL/YMIzTtcpFvyhr5qu7PGja265A/hKuolSKtqk6QGMNpmGamr/7zQ8d/KR57Z5VXi8W7tfr2V79QoS6G0dzLEv8BERhXLfGsLDcBDHnlMQzVBtyyauZ3lkMIIY8I2V/HjD7z4RQHZdhGGNs6qvcY483xs9zOISDObenIYCuYj7+xJNqrXfU2KDrJ6LoCp0GcpwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://www.yehuishou.com/notify_url";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://www.yehuishou.com/return_url";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关   -- https://openapi.alipay.com/gateway.do
	// 沙箱测试     --  https://openapi.alipaydev.com/gateway.do
	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

